#!/bin/bash
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo  "${green}--------- git 提交预检测 ---------${reset}"

for FILE in `git diff --name-only --cached`
do
    if [[ $FILE == *".sh"* || $FILE == *"iconfont.js"* || $FILE == *"ExamplePage"* || $FILE == *"min.js"* || $FILE == *"vendor/"* || $FILE == *"husky/"* || $FILE == *".md"* ]]
    then
        continue
    fi
    grep 'debugger\|console.log(' $FILE 2>&1 >/dev/null
    if [ $? -eq 0 ]
    then
        echo $red $FILE '包含 debugger/console 请完全删除后提交(注释也不可以哦😯😯😯)'
        exit 1
    fi
done
exit


//使用执行 lint-statged 使用本地资源 不下载
npx --no-install lint-staged
